package si.banst.tecajnice.web;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import si.banst.tecajnice.entitete.Ponder;

public class PonderDataModel extends ListDataModel<Ponder> implements
		SelectableDataModel<Ponder> {
	
	public PonderDataModel(List<Ponder> ponderji) {
		super(ponderji);
	}

	@Override
	public Ponder getRowData(String arg0) {
		@SuppressWarnings("unchecked")
		List<Ponder> ponderji = (List<Ponder>) getWrappedData();  
        
        for(Ponder t : ponderji) {  
            if(t.getId().toString().equalsIgnoreCase(arg0))  
                return t;  
        }  
          
        return null;  
	}

	@Override
	public Object getRowKey(Ponder ponder) {
		return ponder.getId().toString();
	}

}
